package sudroid.java.util;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public abstract class AbstractMap<K, V>
  implements Map<K, V>
{
  volatile transient Set<K> keySet = null;
  volatile transient Collection<V> values = null;

  private static boolean eq(Object paramObject1, Object paramObject2)
  {
    int i;
    if (paramObject1 == null)
      if (paramObject2 == null)
        i = 1;
    while (true)
    {
      return i;
      i = 0;
      continue;
      boolean bool = paramObject1.equals(paramObject2);
    }
  }

  public void clear()
  {
    entrySet().clear();
  }

  protected Object clone()
    throws CloneNotSupportedException
  {
    AbstractMap localAbstractMap = (AbstractMap)super.clone();
    localAbstractMap.keySet = null;
    localAbstractMap.values = null;
    return localAbstractMap;
  }

  public boolean containsKey(Object paramObject)
  {
    Iterator localIterator = entrySet().iterator();
    if (paramObject == null)
      if (localIterator.hasNext());
    while (true)
    {
      for (int i = 0; ; i = 1)
      {
        return i;
        if (((Map.Entry)localIterator.next()).getKey() != null)
          break;
      }
      do
      {
        Object localObject = ((Map.Entry)localIterator.next()).getKey();
        if (!paramObject.equals(localObject))
          continue;
        i = 1;
        break;
      }
      while (localIterator.hasNext());
    }
  }

  public boolean containsValue(Object paramObject)
  {
    Iterator localIterator = entrySet().iterator();
    if (paramObject == null)
      if (localIterator.hasNext());
    while (true)
    {
      for (int i = 0; ; i = 1)
      {
        return i;
        if (((Map.Entry)localIterator.next()).getValue() != null)
          break;
      }
      do
      {
        Object localObject = ((Map.Entry)localIterator.next()).getValue();
        if (!paramObject.equals(localObject))
          continue;
        i = 1;
        break;
      }
      while (localIterator.hasNext());
    }
  }

  public abstract Set<Map.Entry<K, V>> entrySet();

  public boolean equals(Object paramObject)
  {
    int i;
    if (paramObject == this)
      i = 1;
    while (true)
    {
      return i;
      if (!(paramObject instanceof Map))
      {
        i = 0;
        continue;
      }
      Map localMap = (Map)paramObject;
      int j = localMap.size();
      int k = size();
      if (j != k)
      {
        i = 0;
        continue;
      }
      try
      {
        Iterator localIterator = entrySet().iterator();
        label140: boolean bool;
        do
        {
          Object localObject1;
          Object localObject2;
          do
          {
            if (!localIterator.hasNext())
            {
              i = 1;
              break;
            }
            Map.Entry localEntry = (Map.Entry)localIterator.next();
            localObject1 = localEntry.getKey();
            localObject2 = localEntry.getValue();
            if (localObject2 != null)
              break label140;
          }
          while ((localMap.get(localObject1) == null) && (localMap.containsKey(localObject1)));
          i = 0;
          break;
          Object localObject3 = localMap.get(localObject1);
          bool = localObject2.equals(localObject3);
        }
        while (bool);
        i = 0;
      }
      catch (ClassCastException localClassCastException)
      {
        i = 0;
      }
      catch (NullPointerException localNullPointerException)
      {
        i = 0;
      }
    }
  }

  public V get(Object paramObject)
  {
    Iterator localIterator = entrySet().iterator();
    if (paramObject == null)
      if (localIterator.hasNext());
    while (true)
    {
      Map.Entry localEntry;
      for (Object localObject1 = null; ; localObject1 = localEntry.getValue())
      {
        return localObject1;
        localEntry = (Map.Entry)localIterator.next();
        if (localEntry.getKey() != null)
          break;
      }
      do
      {
        localEntry = (Map.Entry)localIterator.next();
        Object localObject2 = localEntry.getKey();
        if (!paramObject.equals(localObject2))
          continue;
        localObject1 = localEntry.getValue();
        break;
      }
      while (localIterator.hasNext());
    }
  }

  public int hashCode()
  {
    int i = 0;
    Iterator localIterator = entrySet().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
        return i;
      int j = ((Map.Entry)localIterator.next()).hashCode();
      i += j;
    }
  }

  public boolean isEmpty()
  {
    if (size() == 0);
    for (int i = 1; ; i = 0)
      return i;
  }

  public Set<K> keySet()
  {
    if (this.keySet == null)
    {
      AbstractMap.1 local1 = new AbstractMap.1(this);
      this.keySet = local1;
    }
    return this.keySet;
  }

  public V put(K paramK, V paramV)
  {
    throw new UnsupportedOperationException();
  }

  public void putAll(Map<? extends K, ? extends V> paramMap)
  {
    Iterator localIterator = paramMap.entrySet().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
        return;
      Map.Entry localEntry = (Map.Entry)localIterator.next();
      Object localObject1 = localEntry.getKey();
      Object localObject2 = localEntry.getValue();
      Object localObject3 = put(localObject1, localObject2);
    }
  }

  public V remove(Object paramObject)
  {
    Iterator localIterator = entrySet().iterator();
    Object localObject1 = null;
    if (paramObject == null)
      if ((localObject1 == null) && (localIterator.hasNext()));
    while (true)
    {
      Object localObject2 = null;
      if (localObject1 != null)
      {
        localObject2 = localObject1.getValue();
        localIterator.remove();
      }
      return localObject2;
      Map.Entry localEntry = (Map.Entry)localIterator.next();
      if (localEntry.getKey() != null)
        break;
      localObject1 = localEntry;
      break;
      do
      {
        localEntry = (Map.Entry)localIterator.next();
        Object localObject3 = localEntry.getKey();
        if (paramObject.equals(localObject3))
          localObject1 = localEntry;
        if (localObject1 != null)
          break;
      }
      while (localIterator.hasNext());
    }
  }

  public int size()
  {
    return entrySet().size();
  }

  public String toString()
  {
    Iterator localIterator = entrySet().iterator();
    Object localObject1;
    if (!localIterator.hasNext())
    {
      localObject1 = "{}";
      return localObject1;
    }
    StringBuilder localStringBuilder1 = new StringBuilder();
    StringBuilder localStringBuilder2 = localStringBuilder1.append(123);
    while (true)
    {
      Map.Entry localEntry = (Map.Entry)localIterator.next();
      Object localObject2 = localEntry.getKey();
      Object localObject3 = localEntry.getValue();
      if (localObject2 == this)
      {
        localObject1 = "(this Map)";
        label78: StringBuilder localStringBuilder3 = localStringBuilder1.append(localObject1);
        StringBuilder localStringBuilder4 = localStringBuilder1.append(61);
        if (localObject3 != this)
          break label137;
      }
      label137: for (localObject1 = "(this Map)"; ; localObject1 = localObject3)
      {
        StringBuilder localStringBuilder5 = localStringBuilder1.append(localObject1);
        if (localIterator.hasNext())
          break label143;
        localObject1 = 125;
        break;
        localObject1 = localObject2;
        break label78;
      }
      label143: StringBuilder localStringBuilder6 = localStringBuilder1.append(", ");
    }
  }

  public Collection<V> values()
  {
    if (this.values == null)
    {
      AbstractMap.2 local2 = new AbstractMap.2(this);
      this.values = local2;
    }
    return this.values;
  }

  public class SimpleEntry<K, V>
    implements Map.Entry<K, V>, Serializable
  {
    private static final long serialVersionUID = -8499721149061103585L;
    private final K key;
    private V value;

    public SimpleEntry(V arg2)
    {
      this.key = this$1;
      Object localObject;
      this.value = localObject;
    }

    public SimpleEntry()
    {
      Object localObject1 = this$1.getKey();
      this.key = localObject1;
      Object localObject2 = this$1.getValue();
      this.value = localObject2;
    }

    public boolean equals(Object paramObject)
    {
      int i;
      if (!(paramObject instanceof Map.Entry))
        i = 0;
      while (true)
      {
        return i;
        Map.Entry localEntry = (Map.Entry)paramObject;
        Object localObject1 = this.key;
        Object localObject2 = localEntry.getKey();
        if (AbstractMap.access$0(localObject1, localObject2))
        {
          Object localObject3 = this.value;
          Object localObject4 = localEntry.getValue();
          if (AbstractMap.access$0(localObject3, localObject4))
          {
            i = 1;
            continue;
          }
        }
        i = 0;
      }
    }

    public K getKey()
    {
      return this.key;
    }

    public V getValue()
    {
      return this.value;
    }

    public int hashCode()
    {
      int i;
      if (this.key == null)
      {
        i = 0;
        if (this.value != null)
          break label33;
      }
      label33: for (int j = 0; ; j = this.value.hashCode())
      {
        return i ^ j;
        i = this.key.hashCode();
        break;
      }
    }

    public V setValue(V paramV)
    {
      Object localObject = this.value;
      this.value = paramV;
      return localObject;
    }

    public String toString()
    {
      StringBuilder localStringBuilder1 = new StringBuilder();
      Object localObject1 = this.key;
      StringBuilder localStringBuilder2 = localStringBuilder1.append(localObject1).append("=");
      Object localObject2 = this.value;
      return localObject2;
    }
  }

  public class SimpleImmutableEntry<K, V>
    implements Map.Entry<K, V>, Serializable
  {
    private static final long serialVersionUID = 7138329143949025153L;
    private final K key;
    private final V value;

    public SimpleImmutableEntry(V arg2)
    {
      this.key = this$1;
      Object localObject;
      this.value = localObject;
    }

    public SimpleImmutableEntry()
    {
      Object localObject1 = this$1.getKey();
      this.key = localObject1;
      Object localObject2 = this$1.getValue();
      this.value = localObject2;
    }

    public boolean equals(Object paramObject)
    {
      int i;
      if (!(paramObject instanceof Map.Entry))
        i = 0;
      while (true)
      {
        return i;
        Map.Entry localEntry = (Map.Entry)paramObject;
        Object localObject1 = this.key;
        Object localObject2 = localEntry.getKey();
        if (AbstractMap.access$0(localObject1, localObject2))
        {
          Object localObject3 = this.value;
          Object localObject4 = localEntry.getValue();
          if (AbstractMap.access$0(localObject3, localObject4))
          {
            i = 1;
            continue;
          }
        }
        i = 0;
      }
    }

    public K getKey()
    {
      return this.key;
    }

    public V getValue()
    {
      return this.value;
    }

    public int hashCode()
    {
      int i;
      if (this.key == null)
      {
        i = 0;
        if (this.value != null)
          break label33;
      }
      label33: for (int j = 0; ; j = this.value.hashCode())
      {
        return i ^ j;
        i = this.key.hashCode();
        break;
      }
    }

    public V setValue(V paramV)
    {
      throw new UnsupportedOperationException();
    }

    public String toString()
    {
      StringBuilder localStringBuilder1 = new StringBuilder();
      Object localObject1 = this.key;
      StringBuilder localStringBuilder2 = localStringBuilder1.append(localObject1).append("=");
      Object localObject2 = this.value;
      return localObject2;
    }
  }
}